// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者，助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2021 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件，未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------

import request from '@/utils/request'
import fileRequest from '@/utils/file'

// 首页数据概览
export function viewModelApi() {
  return request({
    url: '/home/homeCount',
    method: 'GET',
  })
}

// 人员饼图
export function chartPersonPie() {
  return request({
    url: '/home/pieCount',
    method: 'get'
  })
}

/**
 * 政治面貌饼图统计
 * @returns {AxiosPromise}
 */
export function zzmmPie() {
  return request({
    url: '/home/zzmmPieCount',
    method: 'get'
  })
}

/**
 * 学历
 * @returns {AxiosPromise}
 */
export function educationTextPieCount() {
  return request({
    url: '/home/educationTextPieCount',
    method: 'get'
  })
}

/**
 *岗位层级
 * @returns {AxiosPromise}
 */
export function positionLevel() {
  return request({
    url: '/home/positionLevel',
    method: 'get'
  })
}

/**
 * 人员类型
 * @returns {AxiosPromise}
 */
export function personTypePieCount() {
  return request({
    url: '/home/personTypePieCount',
    method: 'get'
  })
}


/**
 * 干部衔级饼图统计
 * @returns {AxiosPromise}
 */
export function officerPieCount() {
  return request({
    url: '/home/officerPieCount',
    method: 'get'
  })
}

/**
 * 战士衔级饼状图
 * @returns {AxiosPromise}
 */
export function soldierRankTitlePieCount() {
  return request({
    url: '/home/soldierRankTitlePieCount',
    method: 'get'
  })
}
//电子设备饼图
export function chartElcPie() {
  return request({
    url: '/home/electronicPieCount',
    method: 'get'
  })
}
//保护点饼图
export function chartPointPie() {
  return request({
    url: '/home/pointPieCount',
    method: 'get'
  })
}
//技术阵地厂房饼图
export function chartWorkshopPie() {
  return request({
    url: '/home/plantPieCount',
    method: 'get'
  })
}
//型号类型饼图
export function chartModelTypePie() {
  return request({
    url: '/home/typePieCount',
    method: 'get'
  })
}
//试验类型饼图
export function chartTestsPie() {
  return request({
    url: '/home/testPostCount',
    method: 'get'
  })
}
//试验的型号类型饼图
export function chartTestsMtPie() {
  return request({
    url: '/home/testPostCount',
    method: 'get'
  })
}
//试验的型号类型柱状图
export function chartTestsMtLine(params) {
  return request({
    url: '/home/typePostCount',
    method: 'get',
    params
  })
}
//人员考核柱状图
export function chartPersonCheckLine() {
  return request({
    url: '/home/checkPostCount',
    method: 'get',
  })
}



// 用户曲线图
export function chartUserApi() {
  return request({
    url: '/admin/statistics/home/chart/user',
    method: 'get'
  })
}

// 用户购买统计
export function chartBuyApi() {
  return request({
    url: '/admin/statistics/home/chart/user/buy',
    method: 'get'
  })
}

// 订单量趋势 30天
export function chartOrder30Api() {
  return request({
    url: '/admin/statistics/home/chart/order',
    method: 'get'
  })
}

// 订单量趋势 月
export function chartOrderMonthApi() {
  return request({
    url: '/admin/statistics/home/chart/order/month',
    method: 'get'
  })
}

// 订单量趋势 周
export function chartOrderWeekApi() {
  return request({
    url: '/admin/statistics/home/chart/order/week',
    method: 'get'
  })
}

// 订单量趋势 年
export function chartOrderYearApi() {
  return request({
    url: '/admin/statistics/home/chart/order/year',
    method: 'get'
  })
}

// 首页经营数据
export function businessData() {
  return request({
    url: '/admin/statistics/home/operating/data',
    method: 'get',
  })
}

export function outgoing(data){
  return fileRequest({
    url:'/admin/outgoing/statistics',
    method: 'POST',
    data: data,
    responseType:'blob'
  })
}

export function outgoingData(data){
  return request({
    url:'/admin/outgoing/getStatistics',
    method:'POST',
    data
  })
}

export function getApplyData(params){
  return request({
    url:'/applyList',
    method:'GET',
    params
  })
}

export function cancellationOfLeave(params){
  return request({
    url:'/cancellationOfLeave',
    method:'GET',
    params
  })
}

export function getApplyDetail(id){
  return request({
    url:'/detailById',
    method:'GET',
    params:{id}
  })
}
export function handlerExportOutApi(data){
  return fileRequest({
    url:'/excel/applyListExcel',
    method:'POST',
    data,
    responseType:'blob'
  })
}
